package com.class04.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

/**
 * @ClassDescription:
 * 控制层的配置类
 * （controller,springmvc）
 * 1.controller
 * 2.全局异常处理器
 * 3.handlerMapping  handlerAdapter
 * 4.静态资源处理
 * 5.jsp 视图解析器前后缀
 * 6.json转化器
 * 7.拦截器........
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2023/12/20 15:22
 */
@EnableWebMvc
@Configuration
@ComponentScan({"com.class04.controller","com.class04.exceptionhandler"})
public class WebMvcJavaConfig implements WebMvcConfigurer {
    @Override//开启允许访问静态资源
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }

    @Override//jsp 视图解析器前后缀
    public void configureViewResolvers(ViewResolverRegistry registry) {
        registry.jsp("/WEB-INF/views","jsp");
    }

    @Override//添加拦截器
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new xx)
    }
}
